#line 1 "/Users/Home/Documents/Workspace/IOS_reverse/WeChatRedbag/WeChatRedbag/AddSettingCell.xm"




#import <UIKit/UIKit.h>
#import "MRedBagHead.h"

@interface WCTableViewManager
-(long long)numberOfSectionsInTableView:(UITableView*)tableview;
@end

@interface NewSettingViewController:UIViewController

@end


#include <substrate.h>
#if defined(__clang__)
#if __has_feature(objc_arc)
#define _LOGOS_SELF_TYPE_NORMAL __unsafe_unretained
#define _LOGOS_SELF_TYPE_INIT __attribute__((ns_consumed))
#define _LOGOS_SELF_CONST const
#define _LOGOS_RETURN_RETAINED __attribute__((ns_returns_retained))
#else
#define _LOGOS_SELF_TYPE_NORMAL
#define _LOGOS_SELF_TYPE_INIT
#define _LOGOS_SELF_CONST
#define _LOGOS_RETURN_RETAINED
#endif
#else
#define _LOGOS_SELF_TYPE_NORMAL
#define _LOGOS_SELF_TYPE_INIT
#define _LOGOS_SELF_CONST
#define _LOGOS_RETURN_RETAINED
#endif

@class WCTableViewManager; @class NewSettingViewController; 
static void _logos_method$_ungrouped$WCTableViewManager$switchchange$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UISwitch*); static void _logos_method$_ungrouped$WCTableViewManager$textfieldchange$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, NSNotification*); static void (*_logos_orig$_ungrouped$WCTableViewManager$scrollViewWillBeginDragging$)(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, id); static void _logos_method$_ungrouped$WCTableViewManager$scrollViewWillBeginDragging$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, id); static id (*_logos_orig$_ungrouped$WCTableViewManager$tableView$cellForRowAtIndexPath$)(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*, NSIndexPath*); static id _logos_method$_ungrouped$WCTableViewManager$tableView$cellForRowAtIndexPath$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*, NSIndexPath*); static long long (*_logos_orig$_ungrouped$WCTableViewManager$tableView$numberOfRowsInSection$)(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*, long long); static long long _logos_method$_ungrouped$WCTableViewManager$tableView$numberOfRowsInSection$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*, long long); static long long (*_logos_orig$_ungrouped$WCTableViewManager$numberOfSectionsInTableView$)(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*); static long long _logos_method$_ungrouped$WCTableViewManager$numberOfSectionsInTableView$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*); static double (*_logos_orig$_ungrouped$WCTableViewManager$tableView$heightForRowAtIndexPath$)(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*, NSIndexPath*); static double _logos_method$_ungrouped$WCTableViewManager$tableView$heightForRowAtIndexPath$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST, SEL, UITableView*, NSIndexPath*); static void (*_logos_orig$_ungrouped$NewSettingViewController$viewDidLoad)(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST, SEL); static void _logos_method$_ungrouped$NewSettingViewController$viewDidLoad(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST, SEL); static void _logos_method$_ungrouped$NewSettingViewController$keyboardWillShow$(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST, SEL, NSNotification *); static void _logos_method$_ungrouped$NewSettingViewController$keyboardWillHide$(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST, SEL, NSNotification *); 
static __inline__ __attribute__((always_inline)) __attribute__((unused)) Class _logos_static_class_lookup$NewSettingViewController(void) { static Class _klass; if(!_klass) { _klass = objc_getClass("NewSettingViewController"); } return _klass; }
#line 16 "/Users/Home/Documents/Workspace/IOS_reverse/WeChatRedbag/WeChatRedbag/AddSettingCell.xm"


static void _logos_method$_ungrouped$WCTableViewManager$switchchange$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UISwitch* switchview){
    [GYUserDefault setBool:switchview.isOn forKey:GYSWITCHKEY];
    [GYUserDefault synchronize];
    [MSHookIvar<UITableView*>(self, "_tableView") reloadData];
}

static void _logos_method$_ungrouped$WCTableViewManager$textfieldchange$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, NSNotification* notication){
     UITextField* textfield=[notication object];
    [GYUserDefault setValue:textfield.text forKey:GYTIMEKEY];
    [GYUserDefault synchronize];
}
static void _logos_method$_ungrouped$WCTableViewManager$scrollViewWillBeginDragging$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, id arg1){
    _logos_orig$_ungrouped$WCTableViewManager$scrollViewWillBeginDragging$(self, _cmd, arg1);
    
    if([MSHookIvar<UITableView*>(self, "_tableView").nextResponder.nextResponder isKindOfClass:_logos_static_class_lookup$NewSettingViewController()]){
        [MSHookIvar<UITableView*>(self, "_tableView") endEditing:YES];
    }
}

static id _logos_method$_ungrouped$WCTableViewManager$tableView$cellForRowAtIndexPath$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UITableView* tableview, NSIndexPath* indextpath){
    if([tableview.nextResponder.nextResponder isKindOfClass:_logos_static_class_lookup$NewSettingViewController()]&&indextpath.section==[self numberOfSectionsInTableView:tableview]-1){
        
        UITableViewCell* cell=nil;
        if(indextpath.row==0){
            static NSString* switchcell=@"switchcell";
            cell=[tableview dequeueReusableCellWithIdentifier:switchcell];
            if(!cell){
                cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
            }
            
            cell.textLabel.text=@"自动抢群红包";
            UISwitch* switchbtn=[[UISwitch alloc]init];
            switchbtn.on=[GYUserDefault boolForKey:GYSWITCHKEY];
            [switchbtn addTarget:self action:@selector(switchchange:) forControlEvents:UIControlEventValueChanged];
            cell.accessoryView=switchbtn;
            
            cell.imageView.image=[UIImage imageNamed:[GYUserDefault boolForKey:GYSWITCHKEY]==1?@"unlocked":@"locked"];
            
        }else{
            static NSString* timecell=@"timecell";
            cell=[tableview dequeueReusableCellWithIdentifier:timecell];
            if(!cell){
                cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
            }
            cell.textLabel.text=@"等待时间(秒)";
            UITextField* timefield=[[UITextField alloc]initWithFrame:CGRectMake(0, 0, 120, 40)];
            timefield.keyboardType=UIKeyboardTypeDecimalPad;
            timefield.borderStyle=UITextBorderStyleRoundedRect;
            timefield.text=[GYUserDefault valueForKey:GYTIMEKEY];
            cell.accessoryView=timefield;
            cell.imageView.image=[UIImage imageNamed:@"clock"];
            
            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textfieldchange:) name:UITextFieldTextDidChangeNotification object:timefield];
            
        }
        cell.backgroundColor=[UIColor whiteColor];
        return cell;
    }else{
      return _logos_orig$_ungrouped$WCTableViewManager$tableView$cellForRowAtIndexPath$(self, _cmd, tableview, indextpath);
    }
}

static long long _logos_method$_ungrouped$WCTableViewManager$tableView$numberOfRowsInSection$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UITableView* tableview, long long section){
    if([tableview.nextResponder.nextResponder isKindOfClass:_logos_static_class_lookup$NewSettingViewController()]&&section==[self numberOfSectionsInTableView:tableview]-1){
       return 2;
    }else{
       return _logos_orig$_ungrouped$WCTableViewManager$tableView$numberOfRowsInSection$(self, _cmd, tableview, section);
    }

}
static long long _logos_method$_ungrouped$WCTableViewManager$numberOfSectionsInTableView$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UITableView* tableview){
    if([tableview.nextResponder.nextResponder isKindOfClass:_logos_static_class_lookup$NewSettingViewController()]){
       return _logos_orig$_ungrouped$WCTableViewManager$numberOfSectionsInTableView$(self, _cmd, tableview)+1;
    }else{
      return  _logos_orig$_ungrouped$WCTableViewManager$numberOfSectionsInTableView$(self, _cmd, tableview);
    }
}

static double _logos_method$_ungrouped$WCTableViewManager$tableView$heightForRowAtIndexPath$(_LOGOS_SELF_TYPE_NORMAL WCTableViewManager* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UITableView* tableView, NSIndexPath* indexPath){
    if([tableView.nextResponder.nextResponder isKindOfClass:_logos_static_class_lookup$NewSettingViewController()]){
      return  44;
    }else{
       return _logos_orig$_ungrouped$WCTableViewManager$tableView$heightForRowAtIndexPath$(self, _cmd, tableView, indexPath);
    }
}




static void _logos_method$_ungrouped$NewSettingViewController$viewDidLoad(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd){
    _logos_orig$_ungrouped$NewSettingViewController$viewDidLoad(self, _cmd);
    [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(keyboardWillShow:)
                                                     name:UIKeyboardWillShowNotification
                                                   object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(keyboardWillHide:)
                                                     name:UIKeyboardWillHideNotification
                                                   object:nil];
}

static void _logos_method$_ungrouped$NewSettingViewController$keyboardWillShow$(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, NSNotification * notification){
    NSDictionary *userInfo = [notification userInfo];
    NSValue *value = [userInfo objectForKey:UIKeyboardFrameBeginUserInfoKey];
    CGRect keyboardRect = [value CGRectValue];
    int height = keyboardRect.size.height;
    self.view.frame=CGRectMake(0,-height,[UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
    
}

static void _logos_method$_ungrouped$NewSettingViewController$keyboardWillHide$(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, NSNotification * notification){
    self.view.frame=CGRectMake(0,0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
}


static __attribute__((constructor)) void _logosLocalInit() {
{Class _logos_class$_ungrouped$WCTableViewManager = objc_getClass("WCTableViewManager"); { char _typeEncoding[1024]; unsigned int i = 0; _typeEncoding[i] = 'v'; i += 1; _typeEncoding[i] = '@'; i += 1; _typeEncoding[i] = ':'; i += 1; memcpy(_typeEncoding + i, @encode(UISwitch*), strlen(@encode(UISwitch*))); i += strlen(@encode(UISwitch*)); _typeEncoding[i] = '\0'; class_addMethod(_logos_class$_ungrouped$WCTableViewManager, @selector(switchchange:), (IMP)&_logos_method$_ungrouped$WCTableViewManager$switchchange$, _typeEncoding); }{ char _typeEncoding[1024]; unsigned int i = 0; _typeEncoding[i] = 'v'; i += 1; _typeEncoding[i] = '@'; i += 1; _typeEncoding[i] = ':'; i += 1; memcpy(_typeEncoding + i, @encode(NSNotification*), strlen(@encode(NSNotification*))); i += strlen(@encode(NSNotification*)); _typeEncoding[i] = '\0'; class_addMethod(_logos_class$_ungrouped$WCTableViewManager, @selector(textfieldchange:), (IMP)&_logos_method$_ungrouped$WCTableViewManager$textfieldchange$, _typeEncoding); }{ MSHookMessageEx(_logos_class$_ungrouped$WCTableViewManager, @selector(scrollViewWillBeginDragging:), (IMP)&_logos_method$_ungrouped$WCTableViewManager$scrollViewWillBeginDragging$, (IMP*)&_logos_orig$_ungrouped$WCTableViewManager$scrollViewWillBeginDragging$);}{ MSHookMessageEx(_logos_class$_ungrouped$WCTableViewManager, @selector(tableView:cellForRowAtIndexPath:), (IMP)&_logos_method$_ungrouped$WCTableViewManager$tableView$cellForRowAtIndexPath$, (IMP*)&_logos_orig$_ungrouped$WCTableViewManager$tableView$cellForRowAtIndexPath$);}{ MSHookMessageEx(_logos_class$_ungrouped$WCTableViewManager, @selector(tableView:numberOfRowsInSection:), (IMP)&_logos_method$_ungrouped$WCTableViewManager$tableView$numberOfRowsInSection$, (IMP*)&_logos_orig$_ungrouped$WCTableViewManager$tableView$numberOfRowsInSection$);}{ MSHookMessageEx(_logos_class$_ungrouped$WCTableViewManager, @selector(numberOfSectionsInTableView:), (IMP)&_logos_method$_ungrouped$WCTableViewManager$numberOfSectionsInTableView$, (IMP*)&_logos_orig$_ungrouped$WCTableViewManager$numberOfSectionsInTableView$);}{ MSHookMessageEx(_logos_class$_ungrouped$WCTableViewManager, @selector(tableView:heightForRowAtIndexPath:), (IMP)&_logos_method$_ungrouped$WCTableViewManager$tableView$heightForRowAtIndexPath$, (IMP*)&_logos_orig$_ungrouped$WCTableViewManager$tableView$heightForRowAtIndexPath$);}Class _logos_class$_ungrouped$NewSettingViewController = objc_getClass("NewSettingViewController"); { MSHookMessageEx(_logos_class$_ungrouped$NewSettingViewController, @selector(viewDidLoad), (IMP)&_logos_method$_ungrouped$NewSettingViewController$viewDidLoad, (IMP*)&_logos_orig$_ungrouped$NewSettingViewController$viewDidLoad);}{ char _typeEncoding[1024]; unsigned int i = 0; _typeEncoding[i] = 'v'; i += 1; _typeEncoding[i] = '@'; i += 1; _typeEncoding[i] = ':'; i += 1; memcpy(_typeEncoding + i, @encode(NSNotification *), strlen(@encode(NSNotification *))); i += strlen(@encode(NSNotification *)); _typeEncoding[i] = '\0'; class_addMethod(_logos_class$_ungrouped$NewSettingViewController, @selector(keyboardWillShow:), (IMP)&_logos_method$_ungrouped$NewSettingViewController$keyboardWillShow$, _typeEncoding); }{ char _typeEncoding[1024]; unsigned int i = 0; _typeEncoding[i] = 'v'; i += 1; _typeEncoding[i] = '@'; i += 1; _typeEncoding[i] = ':'; i += 1; memcpy(_typeEncoding + i, @encode(NSNotification *), strlen(@encode(NSNotification *))); i += strlen(@encode(NSNotification *)); _typeEncoding[i] = '\0'; class_addMethod(_logos_class$_ungrouped$NewSettingViewController, @selector(keyboardWillHide:), (IMP)&_logos_method$_ungrouped$NewSettingViewController$keyboardWillHide$, _typeEncoding); }} }
#line 133 "/Users/Home/Documents/Workspace/IOS_reverse/WeChatRedbag/WeChatRedbag/AddSettingCell.xm"
